Skip to content

feat: add custom OpenTelemetry collector endpoints support #7023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Aug 12, 2025

Implements #7020 - Adds the ability to configure custom OpenTelemetry (OTEL) collector endpoints for telemetry traces.

Summary

This PR adds support for configuring custom OpenTelemetry collector endpoints, allowing power users to send telemetry traces to their own collectors for visibility into model/inference activity.

Changes

Core Implementation

  • OpenTelemetryClient: New telemetry client class in packages/telemetry/src/OpenTelemetryClient.ts that:
    • Supports multiple OTEL endpoints with custom headers
    • Respects VSCode telemetry settings and user opt-in preferences
    • Uses batch processing for better performance
    • Includes error handling to prevent disrupting the application

Configuration

  • Added otelEnabled and otelEndpoints fields to the global settings schema
  • Endpoints support URL, custom headers, and individual enable/disable toggles

User Interface

  • Created OpenTelemetrySettings component in the settings view
  • Features include:
    • Enable/disable toggle for OpenTelemetry
    • Add/remove multiple endpoints
    • Configure endpoint URLs and custom headers
    • Collapsible UI for better organization
    • Per-endpoint enable/disable toggles

Integration

  • Integrated OTEL client initialization in extension startup
  • Added message handlers for OTEL settings updates between webview and extension
  • OTEL client is registered with the telemetry service when enabled

Testing

  • Comprehensive test suite for OpenTelemetryClient covering:
    • Initialization with multiple endpoints
    • Event capture and span creation
    • Telemetry state management
    • Error handling
    • Shutdown procedures

Testing Instructions

  1. Open the Roo Code settings
  2. Navigate to the OpenTelemetry section
  3. Enable OpenTelemetry and add a collector endpoint
  4. Configure the endpoint URL (e.g., https://otel-collector.example.com/v1/traces)
  5. Optionally add custom headers for authentication
  6. Save settings and restart VS Code
  7. Telemetry traces will be sent to the configured endpoints

Notes

  • Changes to endpoints require restarting VS Code to take effect
  • The implementation respects VSCode global telemetry settings
  • All tests pass successfully

Closes #7020


Important

Adds support for custom OpenTelemetry collector endpoints, allowing users to configure and send telemetry traces to their own endpoints.

  • Behavior:
    • Adds OpenTelemetryClient in OpenTelemetryClient.ts to handle telemetry with custom OTEL endpoints.
    • Supports multiple endpoints, custom headers, and respects VSCode telemetry settings.
    • Batch processing and error handling included.
  • Configuration:
    • Adds otelEnabled and otelEndpoints to global settings schema in global-settings.ts.
    • Endpoints can be individually enabled/disabled with custom headers.
  • User Interface:
    • Adds OpenTelemetrySettings component in OpenTelemetrySettings.tsx for configuring OTEL settings.
    • UI includes toggles for enabling OTEL and managing endpoints.
  • Integration:
    • Initializes OpenTelemetryClient in extension.ts if enabled in settings.
    • Updates webviewMessageHandler.ts to handle OTEL settings updates.
  • Testing:
    • Adds tests in OpenTelemetryClient.test.ts for initialization, event capture, and error handling.
  • Misc:
    • Updates package.json to include OpenTelemetry dependencies.

This description was created by Ellipsis for bb00d6c. You can customize this summary. It will automatically update as commits are pushed.

- Add OpenTelemetryClient class to packages/telemetry for sending traces to custom OTEL endpoints
- Add OTEL configuration fields (otelEnabled, otelEndpoints) to global settings schema
- Create UI components in settings view for managing OTEL endpoints with add/remove/edit capabilities
- Integrate OTEL client initialization in extension startup
- Add message handlers for OTEL settings updates between webview and extension
- Include comprehensive test coverage for OpenTelemetryClient
- Support multiple endpoints with custom headers and enable/disable toggles per endpoint

Implements #7020
@roomote roomote bot requested review from mrubens, cte and jr as code owners August 12, 2025 21:15
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Aug 12, 2025
setCachedStateField: SetCachedStateField<"otelEnabled" | "otelEndpoints">
}

export const OpenTelemetrySettings = ({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the i18n translation function (e.g. t('...')) for all user‐visible strings like 'OpenTelemetry', 'Add Endpoint', and 'Collector Endpoints' to ensure consistency with the rest of the app.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.


// Create resource with service information
const version =
vscode?.extensions?.getExtension?.("rooveterinaryinc.roo-cline")?.packageJSON?.version || "unknown"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extension identifier "rooveterinaryinc.roo-cline" might be a typographical error. Should it be "rooveterinaryinc.roo-code" or another identifier? Please confirm.

Suggested change
vscode?.extensions?.getExtension?.("rooveterinaryinc.roo-cline")?.packageJSON?.version || "unknown"
vscode?.extensions?.getExtension?.("rooveterinaryinc.roo-code")?.packageJSON?.version || "unknown"

Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing my own code because apparently I trust no one, not even myself.


// Create resource with service information
const version =
vscode?.extensions?.getExtension?.("rooveterinaryinc.roo-cline")?.packageJSON?.version || "unknown"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this extension ID intentional? I noticed it's hardcoded as 'rooveterinaryinc.roo-cline' - should this perhaps be updated to match the actual extension ID or made configurable?

}
}

export interface OtelEndpoint {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding JSDoc comments for the OtelEndpoint interface properties to clarify what each field represents:


// Add exporters for each endpoint
for (const endpoint of this.endpoints) {
const exporter = new OTLPTraceExporter({
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be beneficial to add retry logic here for transient network failures? Other telemetry implementations in the codebase seem to have retry mechanisms.

URL
</label>
<VSCodeTextField
value={endpoint.url}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding basic URL validation here to prevent configuration errors. Something like:

Then you could show a validation error if the URL is invalid.

)}

<div className="text-vscode-descriptionForeground text-sm mt-2">
<strong>Note:</strong> Changes to endpoints require restarting VS Code to take effect.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The restart requirement note is important but might be missed at the bottom. Consider making it more prominent, perhaps showing a notification when settings are saved, or moving this warning to the top of the section?

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 12, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 15, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 15, 2025
@daniel-lxs
Copy link
Collaborator

Author interested in implementing this

@daniel-lxs daniel-lxs closed this Aug 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 15, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR - Needs Preliminary Review size:XXL This PR changes 1000+ lines, ignoring generated files. UI/UX UI/UX related or focused
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add the ability to add custom OTEL collector endpoints
3 participants